<?php
//查询用户名
session_start();
$userId = $_SESSION['userId'];
include('../mysqli_connect.php');
$sql = "select nike_name from user where user_id={$userId}";
$res = mysqli_query($dbc, $sql);
if (!$res) {
  printf("Error: %s\n", mysqli_error($dbc));
  exit();
}
$result = mysqli_fetch_array($res);
if (mysqli_num_rows($res) == 1) {
  $response = array('status' => true, 'message' => '查询用户名成功', 'data' => $result);
  echo json_encode($response);
} else {
  $response = array('status' => false, 'message' => '查询用户名失败');
  echo json_encode($response);
}
